package com.codedancer.campus.mapper;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.codedancer.campus.common.core.BaseMapper;
import com.codedancer.campus.po.FeedbackRecordType;
import com.codedancer.campus.qo.feedbackRecordType.FeedbackRecordTypePageSearchQo;

public interface FeedbackRecordTypeMapper extends BaseMapper<FeedbackRecordType> {

    /**
     * 分页查询反馈记录类型
     *
     * @param feedbackRecordTypePage
     * @param feedbackRecordTypePageSearchQo
     * @return
     */
    default IPage<FeedbackRecordType> page(Page<FeedbackRecordType> feedbackRecordTypePage,
        FeedbackRecordTypePageSearchQo feedbackRecordTypePageSearchQo) {
        LambdaQueryWrapper<FeedbackRecordType> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        if (ObjectUtil.isNotEmpty(feedbackRecordTypePageSearchQo.getName())) {
            lambdaQueryWrapper.like(FeedbackRecordType::getName,
                feedbackRecordTypePageSearchQo.getName());
        }
        return selectPage(feedbackRecordTypePage, lambdaQueryWrapper);
    }
}
